package edu.mama.college.service;

import edu.mama.college.mapper.UserCourseMapper;
import edu.mama.college.model.UserCourse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class UserCourseService {

    @Autowired
    private UserCourseMapper userCourseMapper;

    public List<UserCourse> getUserCourseList(int userId,int page,int size){
        return userCourseMapper.userCourseList(userId,(page-1)*size,size);
    }

    public int getUserCourseTotal(int userId){
        System.out.println("getUserCourseTotal");
        return userCourseMapper.userCourseTotal(userId);
    }

    public UserCourse getUserCourse(int userId,int courseId){
        return userCourseMapper.userCourse(userId,courseId);
    }

    public void addUserCourse(UserCourse userCourse){
         userCourseMapper.addUserCourse(userCourse);
    }
//
    public void updateStudying(UserCourse userCourse){
        userCourseMapper.updateStudying(userCourse);
    }

    public void updateStatus(){
        userCourseMapper.updateStatus();
    }
}
